<?php
/** 
 * @Description: 静态资源链接 
 * @Author: Zheng_Great
 * @Date: 2020-05-08 12:25:08
 */

namespace  common\services;

use yii\helpers\Url;

class UrlService {

	//构建官网端的链接
	public static function buildWwwUrl( $path,$params = [] ){
		$domain_config = \Yii::$app->params['domain'];
		// var_dump($domain_config);exit;
		$path = Url::toRoute(array_merge([ $path ],$params));
		return $domain_config['www'].$path;
	}

	//构建web端的链接
	public static function buildWebUrl( $path,$params = [] ){
		$domain_config = \Yii::$app->params['domain'];
		$path = Url::toRoute(array_merge([ $path ],$params));
		return $domain_config['web'] .$path;
	}
	
	//构建会员端的链接
	public static function buildMUrl( $path,$params = [] ){
		$domain_config = \Yii::$app->params['domain'];
		$path = Url::toRoute(array_merge([ $path ],$params));
		return $domain_config['m'] .$path;
	}


	// 空链接
	public static function buildNullUrl(){
		return "javascript:void(0);";
	}

	// 图片上传链接
	public static function buildPicUrl( $bucket,$file_key ){
		$domain_config = \Yii::$app->params['domain'];
		$upload_config = \Yii::$app->params['upload'];
		return $domain_config['www'].$upload_config[ $bucket ]."/".$file_key;
	}
}